home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-02 / fgl110c.zip / 09-14.C < prev    next >
Text File  |  1992-01-31  |  959b  |  46 lines

  1. #include <fastgraf.h>
  2. #include <stdio.h>
  3. #include <stdlib.h>
  4.  
  5. void main(void);
  6.  
  7. int CGApatterns[] = {
  8.    0x0000,0x00FF,0x00FF,0x00FF,
  9.    0x02BB,0x0000,0x0222,0x0255,
  10.    0x00FF,0x00FF,0x00FF,0x0055,
  11.    0x00AA,0x00AA,0x00FF,0x0277
  12.    };
  13.  
  14. void main()
  15. {
  16.    int color;
  17.    int old_mode, new_mode;
  18.  
  19.    new_mode = fg_bestmode(320,200,1);
  20.    if (new_mode < 0 || new_mode == 12) {
  21.       printf("This program requires a 320 ");
  22.       printf("x 200 color graphics mode.\n");
  23.       exit(1);
  24.       }
  25.  
  26.    old_mode = fg_getmode();
  27.    fg_setmode(new_mode);
  28.  
  29.    if (new_mode == 4) {
  30.       fg_palette(0,0);
  31.       for (color = 0; color < 16; color++)
  32.          fg_pattern(color,CGApatterns[color]);
  33.       }
  34.    else if (new_mode == 9 || new_mode == 13)
  35.       fg_pattern(15,0x04F7);
  36.    else
  37.       fg_setrgb(15,38,38,38);
  38.  
  39.    fg_move(0,199);
  40.    fg_dispfile("coral.ppr",320,1);
  41.    fg_waitkey();
  42.  
  43.    fg_setmode(old_mode);
  44.    fg_reset();
  45. }
  46.